﻿/*************************************************************************
 * Created by OhZee Creative, LLC
 * 2013
 * This code is licensed under Microsoft Public License (Ms-PL)
 * http://opensource.org/licenses/ms-pl
 * http://ozframework.codeplex.com/
 *************************************************************************/

namespace OhZeeCreative.Helpers
{
    using System;
    using System.Diagnostics;

	public static class DebugHelper
	{
		static DebugHelper()
		{
			BreakOnAssert = true;
		}

		public static bool BreakOnAssert { get; set; }

		public static void Fail(Exception ex = null)
		{
			Debugger.Break();
		}

		public static void Assert(bool condition)
		{
			if (BreakOnAssert && !condition)
			{
				Debugger.Break();
			}
		}

		public static void AreEqual<T>(T expected, T actual)
		{
			if (expected == null)
			{
				if (actual != null)
				{
					string message = string.Format("Expected null, Received '{0}'", actual);
					Debugger.Break();
				}
			}
			else
			{
				if (!expected.Equals(actual))
				{
					string message = string.Format("Expected '{0}', Received '{1}'", expected, actual);
					Debugger.Break();
				}
			}
		}
	}
}
